<?php

/**
 * This is the model class for table "{{tqq_userdata}}".
 *
 * The followings are the available columns in table '{{tqq_userdata}}':
 * @property string $uid
 * @property string $ot
 * @property string $ots
 * @property string $otime
 * @property string $addtime
 * @property string $uname
 * @property string $unick
 * @property string $uhead
 * @property string $ugood
 * @property string $ubad
 * @property string $gettime
 * @property string $utype
 */
class TqqUserdata extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TqqUserdata the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{tqq_userdata}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ot, ots, uhead', 'length', 'max'=>64),
			array('otime, addtime, gettime', 'length', 'max'=>10),
			array('uname, unick', 'length', 'max'=>32),
			array('ugood, ubad, utype', 'length', 'max'=>4),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('uid, ot, ots, otime, addtime, uname, unick, uhead, ugood, ubad, gettime, utype', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'uid' => 'Uid',
			'ot' => 'Ot',
			'ots' => 'Ots',
			'otime' => 'Otime',
			'addtime' => 'Addtime',
			'uname' => 'Uname',
			'unick' => 'Unick',
			'uhead' => 'Uhead',
			'ugood' => 'Ugood',
			'ubad' => 'Ubad',
			'gettime' => 'Gettime',
			'utype' => 'Utype',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('uid',$this->uid,true);
		$criteria->compare('ot',$this->ot,true);
		$criteria->compare('ots',$this->ots,true);
		$criteria->compare('otime',$this->otime,true);
		$criteria->compare('addtime',$this->addtime,true);
		$criteria->compare('uname',$this->uname,true);
		$criteria->compare('unick',$this->unick,true);
		$criteria->compare('uhead',$this->uhead,true);
		$criteria->compare('ugood',$this->ugood,true);
		$criteria->compare('ubad',$this->ubad,true);
		$criteria->compare('gettime',$this->gettime,true);
		$criteria->compare('utype',$this->utype,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}